/*
 * mockMain.cpp
 *
 *  Created on: Oct 10, 2014
 *      Authors: Avihay Avitan & Stefan Farcas
 */

#include "PredictionModuleBridge/PredictionModuleBridgeFromTextFile.h"
//#include "CoreSettings/CoreSettings.h"

using namespace PredictionModuleBridgeSpace;
using namespace PassPrioritizerNameSpace;
void printAERs(PassVector *pvector);
void Tester();


int main ()
{

	Tester();

}

void Tester()
{
	PredictionModuleBridgeFromTextFile predictionModule;
	PredictionTextFileParser textFileParser;

	predictionModule.setTextFileParser(&textFileParser);
	PassPrioritizer * prioritizer = new PassPrioritizer();
	predictionModule.loadPredictionData(prioritizer);

	if (prioritizer != NULL)
	{
		int i = 1;
		while(prioritizer->hasNext())
		{
			PassVector * pvector = prioritizer->getNext();
			std::cout << "Pass " << i++ << ": " << pvector->getSatId() << std::endl ;
			std::cout << "Access information:"<<endl
						<<"start time: " << pvector->getAccess().getStartTime()<<endl
						<<"end time: "<< pvector->getAccess().getEndTime()<<endl
						<<"duration: "<< pvector->getAccess().getDuration()<<endl
						<<"interval: "<< pvector->getAccess().getInterval()<< std::endl ;
			std::cout << "AERs:"<<endl;
			printAERs(pvector);
		}
	}

	getchar();
	getchar();
}

void printAERs(PassVector *pvector)
{
	int i= 1;
	while (pvector->hasNextInstance())
	{
		SatelliteAER * instance = pvector->popNextInstance();
		long azimuth = instance->getAzimuth();
		long elev = instance->getElevation();
		long rang = instance->getRange();
		long timestamp = instance->getTimeStamp();
		std::cout << i++ << ": timestamp: " <<timestamp <<", Azimuth: " <<azimuth <<", Elevation: "<<elev<<", Range: "<<rang<< std::endl ;
		delete(instance);
	}
}
